package com.toby.service.impl;

import com.toby.dao.ProductDao;
import com.toby.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

/**
 * @desc: 产品Service
 * @author: jonathan.zhang
 * @date: 2019/10/8 22:28
 */
@Service
public class ProductServiceImpl implements ProductService {
    @Autowired
    private ProductDao productDao;
    @Override
    @Transactional(rollbackFor = Exception.class)
    public void updateProductStore(Integer productId) {
        try {
            productDao.updateProduct(productId);
        } catch (Exception e) {
            throw new RuntimeException("扣库存异常");
        }
    }
}
